package com.springcloud.dubbo_consumer.controller;

import com.springcloud.dubbo_api.service.HelloService;
import com.springcloud.dubbo_consumer.vo.UserVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "用户管理")
@RestController
@RequestMapping("/user")
public class HelloController {
    @Reference
    private HelloService helloService;

    @Operation(summary ="hello")
    @GetMapping("/hello")
    public String hello() {
        return helloService.hello("Dubbo!");
    }

    @Operation(summary = "新增用户", security = @SecurityRequirement(name = "Authorization"))
    @GetMapping("/add")
    public UserVo add(UserVo user) {
        return user;
    }
}
